import os
from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.actions import ExecuteProcess
from launch_ros.actions import Node
from launch.substitutions import PathJoinSubstitution

def generate_launch_description():
    pkg_sls_launch_sim = get_package_share_directory('sls_launch_sim')
    world_sdf_path = os.path.join(pkg_sls_launch_sim, 'worlds', 'ugv.sdf')

    # 启动 Gazebo 世界
    gz_sim = ExecuteProcess(
        cmd=[
            'python3',
            os.path.join(pkg_sls_launch_sim, 'gzstart', 'simulation-gazebo.py'),
            '--world', world_sdf_path,
            '--selfpath', pkg_sls_launch_sim,
            '--gui'
        ],
        output='screen'
    )



    return LaunchDescription([
        gz_sim,
    ])
